<template>
    <s-table ref="tableRef" :data="loadData"  :scroll="{ x: 1200, }"  :columns="columns" :pagination="false" class="mb-2">
        <template #bodyCell="{ column, record, index }">
            <template v-if="column.key === 'index'">
                {{ index + 1 }}
            </template>
        </template>
    </s-table>
</template>

<script setup name="invitebid">
import api from '@/api/pm/bid/index'
const props = defineProps({
    proId: {
        type: String,
    },
})
const { proId } = toRefs(props)

const columns = [
{
        title: '序号',
        dataIndex: 'index',
        key: 'index',
        width: 70,
    },
    {
        title: '项目编号',
        dataIndex: 'proCode',
        key: 'proCode',
        width: 180,
        align: "center",
    },
    {
        title: '项目名称',
        dataIndex: 'proName',
        key: 'proName',
        width: 180,
        align: "center",
    },
    {
        title: '创建时间',
        dataIndex: 'createTime',
        key: 'createTime',
        width: 180,
        align: "center",
    },
    {
        title: '发起人',
        dataIndex: 'initiator',
        key: 'initiator',
        width: 180,
        align: "center",

    },
    // {
    //     title: '投标阶段',
    //     dataIndex: 'step',
    //     key: 'step',
    //     width: 180,
    //     align: "center",
    // },
    {
        title: '方案报价（元）',
        dataIndex: 'bidPlanAmount',
        key: 'bidPlanAmount',
        width: 180,
        align: "center",

    },
    {
        title: '投标结果',
        dataIndex: 'bidResult',
        key: 'bidResult',
        width: 180,
        align: "center",
    },
]
 
const tableRef = ref()
const loadData = (parameter) => {
    const searchFormState = ref({
        proId: proId
    })
    searchFormState.value.current = parameter.current
    searchFormState.value.size = parameter.size
    return api.page(searchFormState.value).then((res) => {
        return res
    })
}





watch(
    () => props.proId,
    (newVal, oldVal) => {
        if (newVal) {
            nextTick(() => {
                tableRef.value.refresh(true)
            })
        }
    },
    { deep: true, immediate: true }
)


</script>
